#include <stdio.h>
#include <netinet/ether.h>
#include <netinet/in.h>


int main(int argc, char **argv)
{
	struct in_addr ip;
	struct ether_addr mac;
	char *interface;
	int x;

	if (argc != 3){
		printf("I need an interface device and a mac\n");
		return -1;
		}

	interface = argv[1];
	memcpy(&mac,ether_aton(argv[2]),sizeof(struct ether_addr));

	while (1) {
		x =discover_router_address(&mac, interface, &ip);
		if (x != 0)
			printf("[test_libtick]IP NOT FOUND\n");
		else {
			printf("[test_libtick]Ip found : %s\n", inet_ntoa(ip));
			return 0;
		}
		
	}

	/*
	inet_aton("192.168.1.1", &ip);
	
	memcpy(&mac, ether_aton("AB:CD:EF:01:02:03"), sizeof(struct ether_addr));
	printf("return value : %d\n", save_new_addr_in_ddbb(&mac, &ip));

	printf("looking for the mac\n");
	if (exists_in_ddbb(&mac, &ip))
		printf("la ip es: %s\n", inet_ntoa(ip));
	else
		printf("no ip men\n"); */

	return 0;
}
